using System.IO;
using UnityMethods.Extend;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;

namespace UnityTemplate.API
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    //var config = new ConfigurationBuilder()
                    //.SetBasePath(Directory.GetCurrentDirectory())
                    //.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                    //.Build();

                    //webBuilder.ConfigureKestrel(options =>
                    //{
                    //    options.ListenAnyIP(config["HttpPort"].ToInt(), listenOptions =>
                    //        listenOptions.Protocols = HttpProtocols.Http1);

                    //    options.ListenAnyIP(config["GrpcPort"].ToInt(), listenOptions =>
                    //        listenOptions.Protocols = HttpProtocols.Http2);
                    //});
                    webBuilder.UseStartup<Startup>();
                });
    }
}
